import axios from '../services/request'
import qs from 'qs'
// 注册接口

export const post_register = data => {
    return axios.post('user/register.json', qs.stringify({
        serialNum: data.s_num,
        username: data.account,
        password: data.pwd,
        imageCode: data.pic_code,
        uuid: data.uuid
    }))
}

// 验证账号
export const check_account = username => {
    return axios.get('user/count.json?username=' + username)
    // return axios.get('user/count?username=' + username)

}


// 图片验证码
export const get_pic_code = (uuid) => {
    const proBaseUrl = 'http://192.168.1.85:8888/dataview/'
    return proBaseUrl + 'utils/imageCode?uuid=' + uuid
}

// 验证码校验
export const check_pic_code = (code, uuid) => {
    return axios.post('utils/checkImageCode.json', qs.stringify({
        code,
        uuid
    }))
}

// 登录接口
export const post_login = data => {
    return axios.post('user/login.json', qs.stringify({
        username: data.account,
        password: data.pwd,
        imageCode: data.pic_code,
        uuid: data.uuid
    }))
}


// 验证token
export const check_token = id => {
    return axios.post('utils/checkToken.json', qs.stringify({
        id
    }))
}

